/*
	PROG: cgiving
	LANG: C++
	ID: luiza1
*/

#include <stdio.h>
#include <limits.h>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

int b, m, n;
int bulls[25010][2];
int shortest[50010][2];
int cases;
int nodes;
priority_queue< pair<int, int> > pQueue;
map<int, vector< pair<int, int> > > adjacency_map;

void checkNode(int i) {
	pQueue.pop();

	for (int j=0; j<adjacency_map[i].size(); j++) {
			int k=adjacency_map[i][j].first;
			int l=adjacency_map[i][j].second;

			shortest[k][0] = min(shortest[k][0], shortest[i][0]+l);

			if (!shortest[k][1]) 
				pQueue.push(make_pair(-shortest[k][0], k));
	}

	shortest[i][1]=1;
	nodes--;
}

void dijkstra(int i) {
	nodes=n;

	for (int j=0; j<n; j++) {
		shortest[j][0]=INT_MAX;
		shortest[j][1]=0;
		
		pQueue.push(make_pair(-INT_MAX, j));
	}

	shortest[i][0]=0;
	pQueue.push(make_pair(-0, i));

	while (nodes) {
		if (!shortest[pQueue.top().second][1])
			checkNode(pQueue.top().second);
		else pQueue.pop();
	}		
}

int main() {
//	scanf("%d", &cases);

	freopen("cgiving.in", "r", stdin);
	freopen("cgiving.out", "w", stdout);

//	while (cases--) {
		scanf("%d %d %d", &n, &m, &b);

		for (int i=0; i<m; i++) {
			int path1, path2, length;
			scanf("%d %d %d", &path1, &path2, &length);
			adjacency_map[path1-1].push_back(make_pair(path2-1, length));
			adjacency_map[path2-1].push_back(make_pair(path1-1, length));
		}

		for (int i=0; i<b; i++)
			scanf("%d %d", &bulls[i][0], &bulls[i][1]);

		dijkstra(0);

/*		for (int i=0; i<n; i++)
			printf("%d ", shortest[i][0]);

		printf("\n"); */

		for (int i=0; i<b; i++) {
			int one=bulls[i][0]-1, two=bulls[i][1]-1;
			printf("%d\n", shortest[one][0]+shortest[two][0]);
		}
//	}

	return 0;
}
